/* This file is apart of rtodo
 * 
 * Copyright (c) 2008, Ryan Capote
 * All rights reserved
 * Released under the BSD license
 */
#ifndef TASK_H
#define TASK_H

#include <string>
#include <sstream>
 
class Task
{
    public:
        Task(const std::string& task, int id, int priority);
        Task(const std::string& task, const std::string& project,
            const std::string& context, int id, int priority);
        Task(const std::string& taskdata, int id);
         
        /*!
         * Generates and returns a string that contains the task's data
         * @return A string of the task's data
         */
        std::string serialize();
        
        /*!
         * @return Returns the project
         */
        std::string getProject();
        
        /*!
         * Sets the project the task is apart of
         * @param project The string to set the project to
         */
        void setProject(const std::string& project);
        
        /*!
         * @return Returns the task description
         */
        std::string getTask();
        
        /*!
         * Sets the task's description
         * @param task The task description
         */
        void setTask(const std::string& task);
        
        /*!
         * @return Returns the task's context
         */
        std::string getContext();
        
        /*!
         * @param context The context to set the task to
         */
        void setContext(const std::string& context);
        
        /*!
         * @return Returns the task's priority
         */
        int getPriority();
        
        /*!
         * Sets the task's priority
         * @param priority The task's priority between 1 and 5.
         */
        void setPriority(int priority);
        
        /*!
         * Toggles whether the task is marked as a next action.
         */
        void toggleNext();
        
        /*!
         * @return Returns whether the task is a next action.
         */
        bool isNext();
        
        /*!
         * Toggles wither the task is done.
         */
        void toggleDone();
        
        /*!
         * @return Returns whether the task is done.
         */
        bool isDone();
        
        /*!
         * @return Returns the task's id.
         */
        int getId();
        
    private:
        std::string m_project;
        std::string m_task;
        std::string m_context;
        bool m_next;
        bool m_done;
        int m_priority;
        int m_id;
        
        /*!
         * @return Return's the validated priority
         */
        int validatePriority(int p);

};

#endif